<template>
    <div class="wrapper">
      <el-page-header content="公告详情" @back="goBack"></el-page-header>
      <h2>{{noticeDetail.title}}</h2>
      <el-divider></el-divider>
      <div>
        <span style="font-size: small;">发布时间：{{noticeDetail.createTime ? noticeDetail.createTime.substring(0,16) : ''}}</span>
      </div>
      <div class="details ql-editor" v-html="noticeDetail.details">
      </div>
      <div class="enclosure">
        <div v-if="noticeDetail.enclosureList" v-for="(item,index) in noticeDetail.enclosureList" :key="index">
          <span style="font-size: 13px; font-family: Arial">
          附件 {{index+1}} 【<a :href="item.enclosureUrl">{{item.enclosureName}}</a>】 已下载 {{item.download}} 次
        </span>
        </div>
      </div>
      <el-divider class="bottom_line"></el-divider>
    </div>
</template>

<script>
    import 'quill/dist/quill.core.css';
    import 'quill/dist/quill.snow.css';
    import 'quill/dist/quill.bubble.css';

    export default {
        name: "NoticeDetails",
        data(){
            return{
                noticeDetail: {}
            }
        },
        methods: {
            loadNoticeDetail(){
                const noticeId=this.$route.query.noticeId;
                const params={noticeId: noticeId};
                this.getRequest('/getNoticeDetail', params).then(resp=>{
                    if(resp){
                        this.noticeDetail=resp;
                    }else{
                        console.log("获取公告详情页失败");
                    }
                })
            },
            goBack(){
                this.$router.back();
            }
        },
        mounted() {
            this.loadNoticeDetail();
        }
    }
</script>

<style scoped>
  .wrapper{
    padding-left: 5%;
  }
  h2{
    text-align: center;
    margin-top: 20px;
  }
  .el-divider{
    margin-bottom: 5px;
  }
  .details{
    margin-top: 30px;
    font-size: large;
    font-family: 华光仿宋_CNKI;
    line-height: 2em;
    min-height: 500px;
    text-indent: 2em;   /* 段落缩进2格 */
  }
  .enclosure a{
    text-decoration: none;
    color: black;
  }
  .enclosure a:hover{
    text-decoration: underline;
  }
  .bottom_line{
    margin-top: 8px;
  }
</style>
